home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / os2 / pmddem.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1993-12-25  |  9KB  |  315 lines

  1. /*
  2. @echo off
  3. cls
  4. echo.
  5. echo.
  6. echo ERROR:
  7. echo REXX support not installed
  8. echo You must have REXX support installed to run this
  9. echo program.
  10. echo.
  11. echo To run this program, run Selective Install from
  12. echo your System Setup folder, and install REXX.
  13. exit
  14. */
  15. /*----------------------------------------------*/
  16. /*-- REXX                                     --*/
  17. /*----------------------------------------------*/
  18. /*-- PROGRAM NAME:                            --*/
  19. /*-- install                                  --*/
  20. /*--                                          --*/
  21. /*-- DESCRIPTION:                             --*/
  22. /*-- Installs the demo version of PMD         --*/
  23. /*----------------------------------------------*/
  24. /*-- AUTHOR:                                  --*/
  25. /*-- Kelly Schrock                            --*/
  26. /*----------------------------------------------*/
  27. /*-- DATE:                                    --*/
  28. /*-- 12.13.93                                 --*/
  29. /*----------------------------------------------*/
  30.  
  31. TRACE n
  32. signal on HALT
  33. call LoadLibs
  34.  
  35. /*-- get the command line --*/
  36. parse arg sourcedir destdir
  37.  
  38. /*-- Do the intro --*/
  39. call SysCls
  40. say ''
  41. say '                        PM Designer Installation'
  42. say '                               Demo version'
  43.  
  44. /*-- get dest dir --*/
  45. if destdir = '' then do
  46.   say ''
  47.   say 'Please enter a directory name for PM Designer'
  48.   say '(Default: C:\PMD):'
  49.   parse pull destdir
  50.   /*-- if error --*/
  51.   if destdir = ' ' then do
  52.     destdir = 'C:\PMD'
  53.   end
  54. end
  55.  
  56. if sourcedir = ' ' then do
  57.   thisdir = directory()
  58.   say ''
  59.   say 'Please enter the directory where the program is being installed'
  60.   say 'from(Default: 'thisdir'):'
  61.   parse pull sourcedir
  62.   /*-- if another error --*/
  63.   if sourcedir = ' ' then do
  64.     sourcedir = thisdir
  65.     say 'using the current directory as the source directory.'
  66. end
  67.  
  68. /*-- make sure path is good --*/
  69. If substr( sourcedir, length(sourcedir), 1 ) \= '\' then
  70.     sourcedir = sourcedir||'\'
  71.  
  72. /*-- do main screen --*/
  73. call SysCls
  74. say
  75. say '                   PM Designer Installation'
  76. say '                         Demo version'
  77. say
  78. say 'PM Designer will be Installed with the following settings:'
  79. say
  80. say 'Source directory:      "'sourcedir'"'
  81. say 'Destination directory: "'destdir'"'
  82. say
  83. say
  84. say
  85. say 'Okay to continue(Y/n)?'
  86. k = SysGetKey('NOECHO')
  87. if k = 'N' | k = 'n' then do
  88.   say
  89.   say 'Installation cancelled.'
  90.   exit
  91. end
  92.  
  93. /*-- see if the dest directory exists --*/
  94. Call SysFileTree destdir, file, 'D'
  95.  
  96. if file.0 = '0' then do
  97.   say 'The directory: 'destdir' does not exist on your disk. Create it(Y/n)?'
  98.   k = SysGetKey('NOECHO')
  99.   if k = 'N'| k = 'n' then do
  100.     say
  101.     say 'Installation cancelled.'
  102.     exit
  103.   end
  104.   /*-- create the dest. dir --*/
  105.   rc = SysMkDir(destdir)
  106.   if rc = 0 then do
  107.     say 'The directory ' destdir ' was created successfully.'
  108.   end
  109.   else do
  110.     say 'The directory ' destdir ' could not be created successfully; cancelling.'
  111.     exit
  112.   end
  113. end
  114.  
  115.  
  116. /*--
  117. create the directory tree
  118. --*/
  119. basedir =  destdir
  120. bin =      '\bin'
  121. bitmap =   '\bitmap'
  122. doc =      '\doc'
  123. examples = '\examples'
  124. icons =    '\icons'
  125. include =  '\include'
  126. lib =      '\lib'
  127. skeleton = '\skeleton'
  128. basic =    examples||'\basic'
  129. buttons =  examples||'\buttons'
  130. dialog =   examples||'\dialog'
  131. calc =     examples||'\calc'
  132. m_thread = examples||'\m_thread'
  133. edit =     examples||'\edit'
  134.  
  135. dirs.0 = 14
  136. dirs.1 = bin
  137. dirs.2 = bitmap
  138. dirs.3 = doc
  139. dirs.4 = examples
  140. dirs.5 = icons
  141. dirs.6 = include
  142. dirs.7 = lib
  143. dirs.8 = skeleton
  144. dirs.9 = basic
  145. dirs.10 = buttons
  146. dirs.11 = dialog
  147. dirs.12 = calc
  148. dirs.13 = m_thread
  149. dirs.14 = edit
  150.  
  151. do i = 1 to dirs.0
  152.   Call SysFileTree basedir||dirs.i, file, 'D'
  153.   if file.0 = '0' then do
  154.     rc = SysMkDir(basedir||dirs.i)
  155.     if rc <> 0 then
  156.       if rc <> 5 then do
  157.         say 'Error creating the 'basedir||dirs.i' directory; cancelling...'
  158.         exit
  159.       end
  160.     end
  161.   end
  162.   dirs.i = basedir||dirs.i||'\'
  163. end
  164.  
  165. say 'Source dir: 'sourcedir
  166. say 'Dest dir: 'basedir
  167.  
  168.  
  169. /*-- copy the files --*/
  170. call SysCls
  171. say
  172. say 'Install is copying files, please wait...'
  173. call CopyFile 'README.INF', sourcedir, basedir
  174. call CopyFile 'PMD.ICO', sourcedir, basedir'\BIN'
  175.  
  176. say 'Install is unpacking files, please wait...'
  177. /*-- unpack the archive to the destination directory --*/
  178. command = '@echo y |'||sourcedir||'\PMDDBIN.exe 'basedir '>NUL'
  179. command
  180.  
  181. /*-- create a program object --*/
  182. call SysCls
  183. say
  184. say 'PM Designer can be installed as an object on your desktop.'
  185. say 'Do you want to create it now(Y/n)?'
  186. k = SysGetKey('NOECHO')
  187. if k = 'N' | k = 'n' then call GoodBye
  188.  
  189. say
  190. say 'Creating the program folder,'
  191. x = SysCreateObject("WPFolder",,
  192.                     "PM Designer demo",,
  193.                     "<WP_DESKTOP>",,
  194.         "OBJECTID=<PMD>;ICONFILE="||destdir||"\BIN\PMD.ICO", "replace")
  195. if x = 0 then do
  196.   say 'Unable to create folder; cancelling.'
  197.   exit
  198. end
  199.  
  200. say 'Adding the'
  201.  
  202. say 'ReadMe file,'
  203. x = SysCreateObject("WPProgram",,
  204.                     "Read Me First",,
  205.                     "<PMD>",,
  206.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\README.INF")
  207.  
  208. say 'Order form,'
  209. x = SysCreateObject("WPProgram",,
  210.                     "Order form",,
  211.                     "<PMD>",,
  212.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\ORDER.FRM")
  213.  
  214. say 'License Agreement,'
  215. x = SysCreateObject("WPProgram",,
  216.                     "License Agreement",,
  217.                     "<PMD>",,
  218.                     "EXENAME=E.EXE;PARAMETERS="||destdir||"\LICENSE.TXT")
  219.  
  220. say 'Manual,'
  221. x = SysCreateObject("WPProgram",,
  222.                     "Manual",,
  223.                     "<PMD>",,
  224.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\DOC\PMD.INF")
  225.  
  226. say 'Developers guide,'
  227. x = SysCreateObject("WPProgram",,
  228.                     "Developer's Guide",,
  229.                     "<PMD>",,
  230.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\DOC\DEVGUIDE.INF")
  231.  
  232. say 'API Reference,'
  233. x = SysCreateObject("WPProgram",,
  234.                     "API Reference",,
  235.                     "<PMD>",,
  236.                     "EXENAME=VIEW.EXE;PARAMETERS="||destdir||"\DOC\PMDAPI.INF")
  237.  
  238.  
  239. say 'Program object,'
  240. x = SysCreateObject("WPProgram",,
  241.                     "PM Designer",,
  242.                     "<PMD>",,
  243.   "EXENAME="||destdir||"\BIN\PMD.EXE;STARTUPDIR="||destdir"\BIN;ASSOCFILTER=*.APP")
  244.  
  245. say 'Examples folder,'
  246. x = SysCreateObject("WPShadow",,
  247.                     "Examples",,
  248.                     "<PMD>",,
  249.   "SHADOWID="||destdir||"\EXAMPLES")
  250.  
  251. say 'Projects folder,'
  252. x = SysCreateObject("WPShadow",,
  253.                     "Projects",,
  254.                     "<PMD>",,
  255.   "SHADOWID="||destdir||"\Projects")
  256.  
  257. say 'Project template,'
  258. x = SysSetObjectData(destdir||"\Projects\project", "TEMPLATE=YES")
  259. if x = 0 then do
  260.  say 'Unable to set the "TEMPLATE" attribute on the project template.'
  261.  say 'You will have to do this manually...'
  262. end
  263.  
  264.  
  265. GoodBye:
  266. /*-- exit with a goodbye --*/
  267. say
  268. say 'Done.'
  269. say
  270. say
  271. say 'PM Designer has been installed on your system.'
  272. say
  273. say 'Be sure to read the file README.TXT for up-to-date information.'
  274. say
  275. say 'Press any key to exit installation...'
  276. k = SysGetKey('NOECHO')
  277. call SysCls
  278. '@view.exe '||destdir||'\readme Introduction'
  279. exit
  280.  
  281. /*----------------------------------------------*/
  282. /*-- FUNCTION:                                --*/
  283. /*-- LoadLibs                                 --*/
  284. /*-- ACTION:                                  --*/
  285. /*-- loads the libraries needed by this REXX  --*/
  286. /*----------------------------------------------*/
  287. LoadLibs:
  288.   if RxFuncQuery('SysLoadFuncs') THEN
  289.   do
  290.     /*-- load the load-function --*/
  291.     CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  292.     /*-- load the Sys* utilities --*/
  293.     CALL SysLoadFuncs
  294.   end
  295. return
  296.  
  297. HALT:
  298.   say
  299.   say 'Program cancelled; Interrupted by user.'
  300.   exit
  301.  
  302. /*-----------------------------------------------------------------------------*/
  303. /*-- CopyFile                                                                --*/
  304. /*-----------------------------------------------------------------------------*/
  305. CopyFile: Arg ArgFile2Copy, ArgSourceDir, ArgInstallDir
  306.  
  307.     Say 'Copying 'ArgSourceDir||ArgFile2Copy' to 'ArgInstallDir||'\'||ArgFile2Copy'...'
  308.     Command = '@Copy 'ArgSourceDir||ArgFile2Copy' 'ArgInstallDir||'\'||ArgFile2Copy' >NUL'
  309.     Command
  310.     if rc \= 0 Then Do
  311.         say 'Error! 'ArgFile2Copy' was not installed properly.'
  312.         Pull ConfirmIt
  313.     End
  314.     Return
  315.